package novel.spider.util;

import novel.spider.NovelSiteEnum;
import novel.spider.impl.DefaultChapterDetailSpider;
import novel.spider.interfaces.IChapterDetailSpider;

/**
 * Created by Kau on 2016/10/31.
 */
public final class ChapterDetailSpiderFactory{
    private ChapterDetailSpiderFactory() {}

    /**
     * 通过给定的URL，返回一个实现了IChapterDetailSpider接口的实现类
     * @param url
     * @return
     */
    public static IChapterDetailSpider getChapterDetailSpider(String url){
        IChapterDetailSpider spider = null;
        NovelSiteEnum novelSiteEnum = NovelSiteEnum.GetEnumByUrl(url);
        switch (novelSiteEnum){
            case DingDianXiaoShuo:
            case BiQuGe:
            case KanShuZhong:
            case BiXiaWenXue:
                spider = new DefaultChapterDetailSpider();
        }
        return spider;
    }
}
